<!DOCTYPE html>
<html lang="zh_cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>医院药品管理系统</title>
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/admin/style.css}" media="all">
</head>

<!--插入背景图片-->
<style>
    .layadmin-global-background {
        background-image: url("https://www4.bing.com//th?id=OHR.ReefAwareness_ZH-CN8840949729_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp");
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
        height: 800px;

    }
    .layui-footer{
        /*white-space: pre;*/
        position:fixed;
        left:0px;
        right:0;
        bottom:0;
        height:44px;
        line-height:44px;
        font-weight: bold;
        padding:0 15px;
        opacity: 0.6;
        background-color:#eee
    }

</style>

</head>
<body class="layui-layout-body layadmin-global-background">
<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-md12 my-div">
        </div>
    </div>
</div>
<script src="layui/layui.js"></script>
</body>

<body>
    <div class="login-main">
        <header class="layui-elip">登录</header>
        <form class="layui-form">
            <div class="layui-input-inline">
                <input type="text" name="username" required lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="password" name="password" required lay-verity="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-input-inline login-btn">
                <button lay-submit lay-filter="login" class="layui-bin">登录</button>
            </div>
        </form>
    </div>
    <div class="layui-footer">
            医院药品进销管理系统 &emsp;&emsp;&emsp;&emsp;&emsp; 组员：吴志怡 郑子豪 曾柳 卢志军 李东旭 胡锦钊 苑博文
        </div>
    </div>
    <script th:src="@{/static/layui/layui.js}"></script>
    <script>
        layui.use("form",function () {
            var form = layui.form;
            var $ = layui.$;
            //监听提交
            form.on("submit(login)",function (data) {
                $.ajax({
                    url:"/toLogin",
                    type:"POST",
                    data:data.field,
                    dataType:"json",
                    success: function (result) {
                        if(result.code == "1"){
                            layer.msg(result.msg,{icon:result.icon,anim:result.anim},function () {
                                location.href = "/index";    //登录成功，转向后台主页
                            });
                        }else{
                            layer.msg(result.msg,{icon:result.icon,anim:result.anim});
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>

</body>
</html>